﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using coliseu.BussinessLayer;

namespace coliseu.Views.Servicos
{
    public partial class FrmListTipoServico : Form
    {
        Tipo_servicoBL rBL = new Tipo_servicoBL();

        public FrmListTipoServico()
        {
            InitializeComponent();
        }

        private void FrmListTipoServico_Load(object sender, EventArgs e)
        {
            tiposervicoBindingSource.DataSource = rBL.selecionar();
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            FrmCadTipoServico c = new FrmCadTipoServico(rBL);
            c.ShowDialog();
            tiposervicoBindingSource.DataSource = rBL.selecionar();
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            FrmCadTipoServico c = new FrmCadTipoServico(((tipo_servico)tiposervicoBindingSource.Current), rBL);
            c.ShowDialog();
            tiposervicoBindingSource.DataSource = rBL.selecionar();
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Deseja excluir?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
            {
                rBL.excluir((tipo_servico)tiposervicoBindingSource.Current);
                tiposervicoBindingSource.DataSource = rBL.selecionar();
            }
        }
    }
}
